home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / faxd / t.30.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  8KB  |  189 lines

  1. /*    $Header: /usr/people/sam/fax/faxd/RCS/t.30.h,v 1.21 1994/02/28 14:14:46 sam Rel $ */
  2. /*
  3.  * Copyright (c) 1990, 1991, 1992, 1993, 1994 Sam Leffler
  4.  * Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
  5.  *
  6.  * Permission to use, copy, modify, distribute, and sell this software and 
  7.  * its documentation for any purpose is hereby granted without fee, provided
  8.  * that (i) the above copyright notices and this permission notice appear in
  9.  * all copies of the software and related documentation, and (ii) the names of
  10.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  11.  * publicity relating to the software without the specific, prior written
  12.  * permission of Sam Leffler and Silicon Graphics.
  13.  * 
  14.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  15.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  16.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  17.  * 
  18.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  19.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  20.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  22.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  23.  * OF THIS SOFTWARE.
  24.  */
  25. #ifndef _t30_
  26. #define    _t30_
  27. /*
  28.  * The Group 3/T.30 protocol defines pre-, in-, and post-
  29.  * message phases.  During the pre-message phase, the modems
  30.  * exchange capability information and do "training" to
  31.  * synchronize transmission.  Once this is done, one or more
  32.  * pages of information may be transmitted, and following this
  33.  * the post-message phase allows for retransmission, line
  34.  * turn-around, and so on.
  35.  *
  36.  * Consult CCITT recommendation T.30, "Procedures for Document
  37.  * Facsimile Transmission in the General Switched Telephone
  38.  * Network" (especially pp. 69-109) for further information.
  39.  */
  40.  
  41. /*
  42.  * Note: All the FCF codes after the initial identification
  43.  * commands should include FCF_SNDR or FCF_RCVR ``or-ed in''.
  44.  * For example, 
  45.  *    Calling Station        Called Station
  46.  *    -----------------------------------
  47.  *            <-  FCF_DIS
  48.  *    FCF_DCS|FCF_SNDR  ->
  49.  *                <-  FCF_CFR|FCF_RCVR
  50.  *          <<send message data>>
  51.  *    FCF_EOP|FCF_SNDR  ->
  52.  *            <-  FCF_MCF|FCF_RCVR
  53.  *    FCF_DCN|FCF_SNDR    ->
  54.  */
  55.  
  56. // protocol timeouts in milliseconds
  57. #define    TIMER_T1    ((35+5)*1000)    // 35 +/- 5 seconds
  58. #define    TIMER_T2    ((6+1)*1000)    // 6 +/- 1 seconds
  59. #define    TIMER_T3    ((10+5)*1000)    // 10 +/- 5 seconds
  60. #define    TIMER_T4    3100        // 3.1secs
  61.  
  62. #define    TCF_DURATION    1500        // 1.5 seconds
  63.  
  64. /*
  65.  * Facsimile control field (FCF) values
  66.  */
  67. #define    FCF_SNDR    0x80        // station receiving valid DIS
  68. #define    FCF_RCVR    0x00        // station receiving valid DIS response
  69.  
  70. // initial identification commands from the called to calling station
  71. #define    FCF_DIS        0x01        // digital identification signal
  72. #define    FCF_CSI        0x02        // called subscriber identification
  73. #define    FCF_NSF        0x04        // non-standard facilities (optional)
  74.  
  75. // responses from calling station wishing to recv 
  76. #define    FCF_DTC        (FCF_DIS|FCF_SNDR) // digital transmit command
  77. #define    FCF_CIG        (FCF_CSI|FCF_SNDR) // calling subrscriber identification
  78. #define    FCF_NSC        (FCF_NSF|FCF_SNDR) // non-standard facilities command
  79. // responses from transmitter to receiver
  80. #define    FCF_DCS        (0x40|FCF_DIS)    // digital command signal
  81. #define    FCF_TSI        (0x40|FCF_CSI)    // transmitting subscriber ident.
  82. #define    FCF_NSS        (0x40|FCF_NSF)    // non-standard facilities setup (opt)
  83.  
  84. // DIS definitions (24-bit representation)
  85. #define    DIS_T4XMTR    0x008000    // T.4 sender has docs to poll
  86. #define    DIS_T4RCVR    0x004000    // receiver honors T.4
  87. #define    DIS_SIGRATE    0x003C00    // data signalling rate
  88. #define        DISSIGRATE_V27FB    0x0    // V.27 ter fallback mode
  89. #define        DISSIGRATE_V27    0x4    // V.27 ter
  90. #define        DISSIGRATE_V29    0x8    // V.29
  91. #define        DISSIGRATE_V17    0x1    // V.17 (14.4KB)
  92. #define    DIS_7MMVRES    0x000200    // vertical resolution = 7.7 line/mm
  93. #define    DIS_2DENCODE    0x000100    // 2-d compression supported
  94. #define    DIS_PAGEWIDTH    0x0000C0    // recording width capabilities
  95. #define        DISWIDTH_1728    0    // only 1728
  96. #define        DISWIDTH_2432    1    // 2432, 2048, 1728
  97. #define        DISWIDTH_2048    2    // 2048, 1728
  98. #define        DISWIDTH_INVALID    3    // invalid, but treat as 2432
  99. #define    DIS_PAGELENGTH    0x000030    // max recording length capabilities
  100. #define        DISLENGTH_A4    0    // A4 (297 mm)
  101. #define        DISLENGTH_UNLIMITED    1    // no max length
  102. #define        DISLENGTH_A4B4    2    // A4 and B4 (364 mm)
  103. #define        DISLENGTH_INVALID    3
  104. #define    DIS_MINSCAN    0x00000E    // receiver min scan line time
  105. #define        DISMINSCAN_20MS    0x0
  106. #define        DISMINSCAN_40MS    0x1
  107. #define        DISMINSCAN_10MS    0x2
  108. #define        DISMINSCAN_10MS2    0x3
  109. #define        DISMINSCAN_5MS    0x4
  110. #define        DISMINSCAN_40MS2    0x5
  111. #define        DISMINSCAN_20MS2    0x6
  112. #define        DISMINSCAN_0MS    0x7
  113. #define    DIS_XTNDFIELD    0x000001    // extended field indicator
  114.  
  115. // first extension byte
  116. #define    DIS_2400HS    0x80        // 2400 bit/s handshaking
  117. #define    DIS_2DUNCOMP    0x40        // uncompressed 2-d data supported
  118. #define    DIS_ECMODE    0x20        // error correction mode supported
  119. // NB: bit 28 must be zero
  120. #define    DIS_ELMODE    0x08        // error limiting mode suported
  121. #define    DIS_G4COMP    0x02        // T.6 compression supported
  122. // bit 32 is an extension
  123.  
  124. // DCS definitions (24-bit representation)
  125. #define    DCS_T4RCVR    0x004000    // receiver honors T.4
  126. #define    DCS_SIGRATE    0x003C00    // data signalling rate
  127. #define        DCSSIGRATE_2400V27    (0x0<<10)
  128. #define        DCSSIGRATE_4800V27    (0x4<<10)
  129. #define        DCSSIGRATE_9600V29    (0x8<<10)
  130. #define        DCSSIGRATE_7200V29    (0xC<<10)
  131. #define        DCSSIGRATE_14400V33    (0x2<<10)
  132. #define        DCSSIGRATE_12000V33    (0x6<<10)
  133. #define        DCSSIGRATE_14400V17    (0x1<<10)
  134. #define        DCSSIGRATE_12000V17    (0x5<<10)
  135. #define        DCSSIGRATE_9600V17    (0x9<<10)
  136. #define        DCSSIGRATE_7200V17    (0xD<<10)
  137. #define    DCS_7MMVRES    0x000200    // vertical resolution = 7.7 line/mm
  138. #define    DCS_2DENCODE    0x000100    // use 2-d encoding
  139. #define    DCS_PAGEWIDTH    0x0000C0    // recording width
  140. #define        DCSWIDTH_1728    (0<<6)
  141. #define        DCSWIDTH_2432    (1<<6)
  142. #define        DCSWIDTH_2048    (2<<6)
  143. #define    DCS_PAGELENGTH    0x000030    // max recording length
  144. #define        DCSLENGTH_A4    (0<<4)
  145. #define        DCSLENGTH_UNLIMITED    (1<<4)
  146. #define        DCSLENGTH_B4    (2<<4)
  147. #define    DCS_MINSCAN    0x00000E    // receiver min scan line time
  148. #define        DCSMINSCAN_20MS    (0x0<<1)
  149. #define        DCSMINSCAN_40MS    (0x1<<1)
  150. #define        DCSMINSCAN_10MS    (0x2<<1)
  151. #define        DCSMINSCAN_5MS    (0x4<<1)
  152. #define        DCSMINSCAN_0MS    (0x7<<1)
  153. #define    DCS_XTNDFIELD    0x000001    // extended field indicator
  154.  
  155. // first extension byte
  156. #define    DCS_2400HS    0x80        // 2400 bit/s handshaking
  157. #define    DCS_2DUNCOMP    0x40        // uncompressed 2-d data supported
  158. #define    DCS_ECMODE    0x20        // error correction mode supported
  159. #define    DCS_FRAMESIZE    0x10        // EC frame size
  160. #define        DCSFRAME_256    (0<<4)    // 256 octets
  161. #define        DCSFRAME_64        (1<<4)    // 64 octets
  162. #define    DCS_ELMODE    0x08        // erorr limiting mode suported
  163. #define    DCS_G4COMP    0x04        // G4 compression supported
  164. // bit 31 is unassigned and bit 32 is an extension
  165.  
  166. // pre-message responses
  167. #define    FCF_CFR        0x21        // confirmation to receive
  168. #define    FCF_FTT        0x22        // failure to train
  169.  
  170. // post-message commands (from transmitter to receiver)
  171. #define    FCF_EOM        0x71        // end-of-page, restart phase B on ack
  172. #define    FCF_MPS        0x72        // end-of-page, restart phase C on ack
  173. #define    FCF_EOP        0x74        // end-of-procedures, hangup after ack
  174. #define    FCF_PRI_EOM    0x79        // EOM, but allow operator intervention
  175. #define    FCF_PRI_MPS    0x7A        // MPS, but allow operator intervention
  176. #define    FCF_PRI_EOP    0x7C        // MPS, but allow operator intervention
  177.  
  178. // post-message responses (from receiver to transmitter)
  179. #define    FCF_MCF        0x31        // message confirmation (ack MPS/EOM)
  180. #define    FCF_RTP        0x33        // ack, continue after retraining
  181. #define    FCF_RTN        0x32        // nak, retry after retraining
  182. #define    FCF_PIP        0x35        // ack, continue after operating interv.
  183. #define    FCF_PIN        0x34        // nak, retry after operation interv.
  184.  
  185. // other line control signals
  186. #define    FCF_DCN        0x5F        // disconnect - initiate call release
  187. #define    FCF_CRP        0x58        // command repeat - resend last command
  188. #endif /* _t30_ */
  189.